package com.kai.factory.before;

/**
 * @Author Mr.Yan
 * @create 2022/3/24 12:44
 * @description:
 */
public class CoffeeShop {
    Coffee coffee;
    public Coffee orderCoffee(String coffeeName){

        if ("american".equalsIgnoreCase(coffeeName)){
            coffee=new AmericanCoffee();
        }else if ("latter".equalsIgnoreCase(coffeeName)){
            coffee=new LetterCoffee();
        }else {
            throw  new RuntimeException("未知咖啡");
        }
        return coffee;
    }

    public void addMilk(){
        coffee.addMilk();
    }

    public void addSalty(){
        coffee.addSalty();
    }
}
